package com.work2.demo;

import com.work2.bean.Users;
import com.work2.service.UsersServiceImpl;

import java.util.List;

public class Test {
    static UsersServiceImpl usersService = new UsersServiceImpl();
    public static void addUser() throws Exception{
        Users users = new Users();
        users.setUsername("嗷嗷");
        users.setUsepwd("888");
        usersService.addUser(users);
    }

    public static void findUser() throws Exception{
        List<Users> user = usersService.findUser();
        user.forEach(System.out::println);
    }

    public static void delUser() throws Exception{
        boolean b = usersService.delUser(4);
        if(b){
            System.out.println("删除成功");
        }else {
            System.out.println("删除失败");
        }
    }

    public static void findMove() throws Exception{
        List<Users> l = usersService.findMove(-5, "", "888");
        l.forEach(System.out::println);
    }

    public static void uptUser() throws Exception{
        Users users = new Users();
        users.setUsepwd("789");
        users.setUsername("马云");
        boolean b = usersService.uptUser(users, 5);
        if(b){
            System.out.println("修改成功");
        }else {
            System.out.println("修改失败");
        }
    }

    public static void main(String[] args) throws Exception{
        uptUser();
    }
}
